<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@include file="/common/taglib.jsp"%>
<%
	response.setHeader("Pragma", "No-cache");
	response.setHeader("Cache-Control", "no-cache");
	response.setDateHeader("Expires", 0);
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	DateFormat format = new SimpleDateFormat("yyyyMMdd");
	Date date = new Date();
	String endDate = format.format(date);
	Calendar calendar = Calendar.getInstance();
	calendar.setTime(date);
	calendar.add(Calendar.DAY_OF_MONTH, -7);
	String beginDate = format.format(calendar.getTime());
	String requestPath = "/zebra/customer/search/SearchAction?method=search";
%>
<html>
	<head>
		<title>start</title>
		<script type="text/javascript" src="<%=path%>/js/ui.js"></script>
		<link id="editCss" rel="stylesheet" type="text/css" href="<%=basePath %>/css/right.css" /> 
	    <link id="editCss" rel="stylesheet" type="text/css" href="<%=basePath %>/css/autoComplete.css" />
	    <script type="text/javascript" src="<%=path%>/js/MzCalendar.js" ></script>
	    <!-- DWR -->
     	<script type='text/javascript' src='<%=basePath%>dwr/interface/keywordBussinees.js'></script>
		<script type='text/javascript' src='<%=basePath%>dwr/engine.js'></script>
		<script type='text/javascript' src='<%=basePath%>dwr/util.js'></script>
	</head>
	<link id="editCss" rel="stylesheet" type="text/css"href="<%=basePath%>/css/right.css" />
	<body>
<form id="searchForm" name="searchForm" method="post"
			action="/zebra/customer/search/SearchAction">
	<div class="search">
			<input type="hidden" name="method" id="method" value="search" />
			<input type="hidden" name="requestPage" id="requestPage" value="0" />
				<ul class="con minHeight">
					<li style="width: auto;">
						<font>搜索设定：</font>
					</li>
					<li style="width: auto;">
						<%-- 日期搜索  --%>
						<font>日期</font>
						<input type="text" class="text" id="beginDate" name="beginDate"
							value="${term.beginDate }" readonly="readonly" />
						<img src="<%=basePath%>/images/timeIco.gif"
							onclick="WebCalendar.start(this,document.getElementById('beginDate'), 'yyyyMMdd')" />
						至
						<input type="text" class="text" id="endDate" name="endDate"
							value="${term.endDate }" readonly="readonly" />
						<img src="<%=basePath%>/images/timeIco.gif"
							onclick="WebCalendar.start(this,document.getElementById('endDate'), 'yyyyMMdd')" />
					</li>
					<li style="width: auto;">
						<c:choose>
							<c:when test="${term.isSearchContent == 1}">						
								<input type="checkbox" name="isSearchContent" id="isSearchContent" value="1"  checked="checked"/>
							</c:when>
							<c:otherwise>
								<input type="checkbox" name="isSearchContent" id="isSearchContent" value="1" />
							</c:otherwise>
						</c:choose>
							搜索正文
					</li>
					<li style="width: auto;">
						<input  type="text" name="keyword" id="keyword" autocomplete="off" value="${term.keyword }"/>
						<input  class="button" type="submit" value="搜索"/>
					</li>
				</ul>
				
		</div>
	
		<c:choose>
			<c:when test="${!empty paging.articles }">
				<div class="tableBox" style="background: #556272;">
					<table border="0" cellspacing="0" cellpadding="0"
						style="width: 100%;">
						<tr>
							<th>序号</th>
							<th>标题</th>
							<th>发布日期</th>
						</tr>
						<c:forEach items="${paging.articles}" var="article" varStatus="index">
							<tr>
								<td>${index.count}</td>
								<td>
									<a href="<%=path%>/zebra/customer/module/customerMonitorAction?method=toArticle&path=${article.url}"
										target="_blank">${article.title}</a>
								</td>
								<td>${article.releaseDate}</td>
							</tr>
						</c:forEach>
					</table>
				</div>
			</c:when>
			<c:otherwise>
			<div class="notice">
				<div>
					对不起，没有数据!!!
					<br />
					请尝试使用其他关键字，或直接联系管理员！！！
				</div>
			</div>
			</c:otherwise>
		</c:choose>
		<div class="paging">
			<div class="page">
<%--			
 				<c:choose>
 					<c:when test="${!empty paging.articles && paging.total > 20 }">
 						[<c:out value="${paging.total / 20}"></c:out>]
 						<c:set var="end" value="${(paging.total / 20) > 10 ? 9 : paging.total / 20}"></c:set>
 						<a class="none" onclick="formSubmit(0)" href="javascript(#); ">&#124;&#65308;最前页</a>
						<a class="none" onclick="formSubmit(${currentPage ==  0 ? 0:currentPage+1})" href="javascript(#); ">&lt;&lt;上一页</a>
 						<c:forEach begin="${currentPage-5}" end="${currentPage+5}" step="1" varStatus="index">
 							<c:if test="${index.count == currentPage}"></c:if>
	 						<a class="none" onclick="formSubmit(${(currentPage-5)+index.count})" href="javascript(#); " >&nbsp;${index.count}&nbsp;</a>
 						</c:forEach>
 						<a class="none" onclick="formSubmit(${currentPage == paging.total / 20 ? paging.total / 20 : currentPage +1})" href="javascript(0);">下一页 &#62;&#62;</a>
						<a class="none" onclick="formSubmit(${paging.total / 20})" href="javascript(0);">最末页 &#62;&#124;</a>
 					</c:when>
 					
 					<c:otherwise>
 					
 					</c:otherwise>
 				</c:choose>
				<a class="none" href="javascript(0); " onclick="formSubmit(0)">&#124;&#65308;最前页</a>
				<a class="none">&lt;&lt;上一页</a>
				
				<a class="none">下一页 &#62;&#62;</a>
				<a class="none">最末页 &#62;&#124;</a>
			</div>
		</div>	
	<script type="text/javascript" >
		function formSubmit(num){
			var form = document.getElementById("searchForm");
			document.getElementById("requestPage").value = num;
			alert(form.action);
			form.submit();
		}
	</script>	
	 --%>
	</form>
	</body>
	
</html>
